<template>
  <div style="margin: 1.5vh">
    <div>
      <el-button type="primary" icon="el-icon-plus" size="medium"
        >新增</el-button
      >
    </div>
    <div style="margin-top: 2vh">
      <el-table
        :data="tableData"
        style="width: 100%"
        :row-class-name="tableRowClassName">
        <el-table-column prop="index" label="序号" width="100"></el-table-column>
        <el-table-column prop="name" label="物料名称" width="180"></el-table-column>
        <el-table-column prop="unit" label="单位" width="80"> </el-table-column>
        <el-table-column prop="supplierName" label="供应商" width="180"> </el-table-column>
        <el-table-column prop="wholeSalePrice" label="批发价" width="80"> </el-table-column>
        <el-table-column prop="retailPrice" label="零售价" width="80"> </el-table-column>
        <el-table-column prop="purchasePrice" label="采购价" width="80"> </el-table-column>
        <el-table-column prop="updateTime" label="价格更新时间" width="280"> </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { getdietIngredientInfo } from "../../api/diet/ingredient";
export default {
  name: "RuoyiUiIngredient",

  data() {
    return {
      tableData: [],
    };
  },

  mounted() {
    this.getdata();
  },

  methods: {
    getdata() {
      getdietIngredientInfo().then((res) => {
        console.log(res);
        this.tableData = res;
      });
    },
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex === 1) {
        return "warning-row";
      } else if (rowIndex === 3) {
        return "success-row";
      }
      return "";
    },
  },
};
</script>

<style lang="scss" scoped></style>
